package day05;
//九九乘法表
public class MultiTable {
    public static void main(String[] args) {
        /*
        int num = 9;
        for (int i = 1; i <= num; i++) {
            System.out.print(i+"*"+num+"="+i*num+"\t"); //输出语句后print不带ln视为不换行
            //System.out.println(); 输出语句内不加入任何内容时, 会作为换行符号
        }
        *
        * 补充:
        * 1. \t: 水平制表位, 固定占8位, 可以用来替换空格符
        * */

        //优化代码, 输出99乘法表
        //循环嵌套
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j+"*"+i+"="+j*i+"\t");
            }
            System.out.println();
        }
        //1
        for (int i=1; i<=9; i++){
            for (int j=1; j<=i; j++){
                System.out.print(j+"*"+i+"="+i*j+"\t");
            }
            System.out.println();
        }
        //2
        for (int i=1; i<=9; i++){
            for(int j=1; j<=i; j++){
                System.out.print(j+"*"+i+"="+j*i+"\t");
            }
            System.out.println();
        }
        //3
        for (int i =1; i<=9; i++){
            for(int j=1; j<=i; j++) {
                System.out.print(j + "*" + i + "=" + j * i + "\t");
            }
            System.out.println();
        }
    }
}
